package myPackage.Child;

import myPackage.Child.SubClass;
import myPackage.parent.SuperClass;
public class ProtectedBecomesPrivate extends SubClass
{
	public static void main(String arg[])
	{
		ProtectedBecomesPrivate obj = new ProtectedBecomesPrivate();
		System.out.println(obj.X);
		System.out.println(obj.Y);
		
		// if we access a protected member of super class in sub class of sub class via
		// reference then it protected member behaves as private.
		
		SubClass child = new ProtectedBecomesPrivate();
		System.out.println(child.X);
		//System.out.println(child.Y);  
		
		SuperClass c = new ProtectedBecomesPrivate();
		System.out.println(c.X);
		//System.out.println(c.Y);
	}
}
